﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace demo.Web.AzureTables
{
    public class Employee : ATSEntityBase
    {

        // for future compatibility
        private const int ENTITY_VERSION = 1;


        public Employee()
            : base()
        {
        }

        public Employee(string departmentID)
            : base()
        {
            SetEntityVersion(ENTITY_VERSION);
            this.PartitionKey = MakePartitionKey(departmentID);
            this.RowKey = this.MakeUniqueID();
        }


        public static string MakePartitionKey(string departmentCode)
        {
            string s = string.Format(@"{0}", departmentCode.ToLower());
            s = AzureHelper.ScrubKey(s, false);         // lower case
            return s;
        }




        /*******************************************************************************
         * public properties
         * 
         */

        public string name { get; set; }
        public string addr { get; set; }
        public string ext { get; set; }


    }
}